package io.cici.cc.mybatis.lite.executor;

import io.cici.cc.mybatis.lite.executor.resultset.ResultContextHandler;
import io.cici.cc.mybatis.lite.mapping.MappedStatement;
import io.cici.cc.mybatis.lite.mapping.Sql;
import io.cici.cc.mybatis.lite.transaction.Transaction;

import java.sql.SQLException;
import java.util.List;

public interface Executor {

    ResultContextHandler NO_RESULT_HANDLER = null;

    int update(MappedStatement ms, Object parameter) throws SQLException;

    <E> List<E> query(MappedStatement ms, Object parameter, ResultContextHandler resultContextHandler, Sql sql)
            throws SQLException;

    <E> List<E> query(MappedStatement ms, Object parameter, ResultContextHandler resultContextHandler)
            throws SQLException;

    List<BatchResult> flushStatements() throws SQLException;

    void commit(boolean required) throws SQLException;

    void rollback(boolean required) throws SQLException;

    Transaction getTransaction();

    void close(boolean forceRollback);

    boolean isClosed();

    void setExecutorWrapper(Executor executor);

}
